﻿@{
    Layout = "~/Views/Shared/_BlogHomeLayout.cshtml";
    var user = ViewBag.UserInfo as Nutshell.Blog.Model.User;
    ViewBag.Title = $"{ user?.Nickname} - 果壳园";
}
@model Nutshell.Blog.ViewModel.Article.BlogsModel
@section style{

}

@*置顶文章列表*@
@{
    var topList = Model.TopArticles;
    if (topList != null && topList.Count() > 0)
    {
        <div class="blog-item">
            <div class="date">
                <span>置顶文章</span>
            </div>
            @foreach (var article in topList)
            {

                <div class="title">
                    <a href="/@article.Author.Login_Name/p/@(article.Article_Id).html">[置顶]@article.Title</a>
                </div>
                <div class="content">
                    <div class="desc">
                        摘要: @article.Introduction
                        <a href="/@article.Author.Login_Name/p/@(article.Article_Id).html">阅读全文</a>
                    </div>
                    <div class="info">
                        posted @@ @article.Creation_Time @article.Author.Nickname 阅读(0) 评论(0)
                        <a href="/article/edit?postid=@article.Article_Id">编辑</a>
                    </div>
                </div>
                <div class="separator"></div>
            }
        </div>
    }
}

@*其他文章，以时间为组*@
@if (Model != null && Model.GroupingArticles.Count() > 0)
{
    foreach (var group in Model.GroupingArticles)
    {
        <div class="blog-item">
            <div class="date">
                <span>@(group.Key.ToString("D"))</span>
            </div>
            @foreach (var article in group)
            {
                <div class="title">
                    <a href="/@article.Author.Login_Name/p/@(article.Article_Id).html">@article.Title</a>
                </div>
                <div class="content">
                    <div class="desc">
                        摘要: @article.Introduction
                        <a href="/@article.Author.Login_Name/p/@(article.Article_Id).html">阅读全文</a>
                    </div>
                    <div class="info">
                        posted @@ @article.Creation_Time @article.Author.Nickname 阅读(0) 评论(0)
                        <a href="/article/edit?postid=@article.Article_Id">编辑</a>
                    </div>
                </div>
                <div class="separator"></div>
            }
        </div>
    }
}

<div class="topicListFooter">
    @{
        if (ViewBag.HasPre ?? false)
        {
            <a href="/@user.Login_Name?page=@ViewBag.Pre">上一页</a>
        }
        if (ViewBag.HasNext ?? false)
        {
            <a href="/@user.Login_Name?page=@ViewBag.Next">下一页</a>
        }
    }
</div>

@section categories{
    @Html.Partial("Article/_Categories", Model.CustomCategories, new ViewDataDictionary() {
        new KeyValuePair<string, object>("UserName", user.Login_Name)
    })
}

@section archives{
    @Html.Partial("Article/_Archives", Model.Archives)
}
